<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="UTF-8">
      <title>arguments动态参数</title>
   </head>
   <body>
      <script>
         function sun() {
            let sum = 0;
            for (let i = 0; i < arguments.length; i++) {
               sum += arguments[i];
            }
            return sum;
         }

         console.log(sun(1, 2, 3, 4, 5));

         function sun2(a, b, ...arr) {
            let sum = a + b
            for (let i = 0; i < arr.length; i++) {
               sum = sum + arr[i];
            }
            return sum;
         }

         console.log(sun2(1, 2, 3, 4, 5));

         const hehe = [1, 2, 3, 4, 5];
         console.log(...hehe)
         console.log(Math.max(...hehe))
         console.log(Math.min(...hehe))
      </script>
   </body>
</html>